//
//  AXHdzqHomeThirdCell.m
//  AnXin100
//
//  Created by 天质弘耕 on 2018/10/30.
//  Copyright © 2018 tzhg. All rights reserved.
//

#import "AXHdzqHomeThirdCell.h"
#import "AXHdzqHomeThirdCollectionCell.h"


@interface AXHdzqHomeThirdCell ()<UICollectionViewDelegateFlowLayout, UICollectionViewDataSource>

@property (nonatomic, strong) UICollectionView *collectionView;

@end



@implementation AXHdzqHomeThirdCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self creatView];
        
    }
    return self;
}

- (void)creatView {
    
    
    /** collectionView */
    
    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
    float w = (Wi-40)/3;
    flowLayout.itemSize = CGSizeMake(w, w + 40);
    /** 最小行间距 */
    flowLayout.minimumLineSpacing =10;
    /** 最小列间距 */
    flowLayout.minimumInteritemSpacing = 10;
    flowLayout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
    self.collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, w+60) collectionViewLayout:flowLayout];
    self.collectionView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self.collectionView registerClass:[AXHdzqHomeThirdCollectionCell class] forCellWithReuseIdentifier:[AXHdzqHomeThirdCollectionCell reuseID]];
    self.collectionView.delegate = self;
    self.collectionView.dataSource = self;
    [self.contentView                                                                                                                               addSubview:self.collectionView];
    
    
    
}




#pragma mark - Collection View Data Source
/** 定义展示的section的个数 */

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
    
    return 1;
}
/** 定义展示的collectionCell的个数 */
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    
    
    return 3;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    
    AXHdzqHomeThirdCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:[AXHdzqHomeThirdCollectionCell reuseID] forIndexPath:indexPath];
    
    
    
    return cell;
}

#pragma mark - collectionViewDelegateFlowLayout

/** UICollectionView被选中时的方法 */

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    
    
    if (self.tapButtonClickedBlock) {
        self.tapButtonClickedBlock(indexPath.row);
    }
    
    
}


#pragma mark - Setter & Getter

//- (NSMutableArray<ZXResourceModel *> *)modelsArray {
//    if (!_modelsArray) {
//        _modelsArray = [NSMutableArray<ZXResourceModel *> array];
//    }
//    return _modelsArray;
//}




@end

